package com.imooc.bigdata.drpc;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.RPC;

import java.io.IOException;
import java.net.InetSocketAddress;

/**
 * RPC Client
 * Created by zghgchao 2018/2/3 10:37
 */
public class RPCClient {
    public static void main(String[] args) throws IOException {

        Configuration configuration = new Configuration();

        long clientVersion = 89898989898989l;

        UserService userService = RPC.getProxy(UserService.class, clientVersion,
                new InetSocketAddress("localhost", 9999),
                configuration);

        userService.addUser("zhangsan", 39);

        System.out.println("From client .. invoked");

        RPC.stopProxy(userService);
    }
}
